<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

//网站前台
Route::get('/',"Home\HomeController@home"); //加载前台界面
Route::get('/home/shouchang',"Home\HomeController@shouchang"); //加载收藏界面
Route::get('/home/users',"Home\HomeController@users"); //加载个人中心
Route::get('/home/jf',"Home\HomeController@jf"); //加载会员积分

//城市级联操作
Route::get('/district',function(){ return view('district.index'); });
Route::get('/district/{upid}',"DistrictController@find"); //加载城市级联信息

//购物车
Route::get('/shop',"ShopController@index"); //加载商品信息
Route::get('/shop/add/{id}',"ShopController@add"); //放入购物车
Route::get('/shop/show',"ShopController@show"); //浏览购物车
Route::get('/shop/del/{id}',"ShopController@del"); //删除购物车中的某个商品
Route::get('/shop/clear',"ShopController@clear"); //清空购物车

//邮件发送测试
Route::get('/mail',"IndexController@mail"); //测试邮件发送

//网站后台路由配置
Route::get('/admin/login',"Admin\LoginController@login"); //加载后台登录界面
Route::post('/admin/dologin',"Admin\LoginController@doLogin"); //执行后台登录
Route::get('/admin/logout',"Admin\LoginController@logout"); //执行退出
Route::get('/admin/getcode',"Admin\LoginController@getCode"); //加载验证码

//后台路由组
Route::group(['prefix' => 'admin','middleware' => 'admin'], function () {
    Route::get('/',"Admin\IndexController@index"); //后台首页
    Route::resource('type', 'Admin\TypeController'); //后台商品类别管理
    Route::resource('goods', 'Admin\GoodsController'); //后台商品信息管理
	Route::resource('friendlink', 'Admin\FriendlinkController'); //后台友情链接管理
	Route::resource('config', 'Admin\ConfigController'); //后台网站配置
    
    Route::resource('users', 'Admin\UsersController');//后台会员管理
    Route::resource('role', 'Admin\RoleController');
    Route::resource('node', 'Admin\NodeController');
    
    Route::get('users/loadRole/{uid}',"Admin\UsersController@loadRole");
    Route::post('users/saveRole',"Admin\UsersController@saveRole");
    
    Route::get('role/loadNode/{rid}',"Admin\RoleController@loadNode");
    Route::post('role/saveNode',"Admin\RoleController@saveNode");
});
